package main.java.com.bookmanager.model;

import main.java.com.bookmanager.util.Classify;

import java.util.Date;
import java.util.Objects;

public class Book {
    private int bookId;  //ID
    private String bookName;  //书名
    private String bookAuthor;  //作者
    private Classify classify;  //种类
    private String status;  //目前状态
    private Date createTime;  //创建时间
    private int quantity;  //在管
    private int lend;  //借出
    private Date returnDate;

    public Date getReturnDate() {
        return returnDate;
    }

    public void setReturnDate(Date returnDate) {
        this.returnDate = returnDate;
    }

    public int getLend() {
        return lend;
    }

    public void setLend(int lend) {
        this.lend = lend;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public int getBookId() {
        return bookId;
    }

    public void setBookId(int bookId) {
        this.bookId = bookId;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    public String getBookAuthor() {
        return bookAuthor;
    }

    public void setBookAuthor(String bookAuthor) {
        this.bookAuthor = bookAuthor;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Classify getClassify() {
        return classify;
    }

    public void setClassify(Classify classify) {
        this.classify = classify;
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        Book book = (Book) o;
        return bookId == book.bookId && Objects.equals(bookName, book.bookName) && Objects.equals(bookAuthor, book.bookAuthor) && Objects.equals(classify, book.classify) && Objects.equals(status, book.status) && Objects.equals(createTime, book.createTime);
    }

    public Book() {
    }

    public Book(int bookId, String bookName, String bookAuthor, Classify classify, String status,Date date,int quantity) {
        this.bookId = bookId;
        this.bookName = bookName;
        this.bookAuthor = bookAuthor;
        this.classify = classify;
        this.status = status;
        this.createTime = date;
        this.quantity = quantity;
        this.lend = 0;
    }

    public Book(int bookId, String bookName, String bookAuthor, Classify classify, String status, Date createTime, int quantity, int lend) {
        this.bookId = bookId;
        this.bookName = bookName;
        this.bookAuthor = bookAuthor;
        this.classify = classify;
        this.status = status;
        this.createTime = createTime;
        this.quantity = quantity;
        this.lend = lend;
    }

    @Override
    public String toString() {
        return bookId+"\t"+bookName+"\t"+bookAuthor+"\t"+classify+"\t"+status+"\t"+createTime+"\t"+quantity;
    }
}
